//
//  WeiPlist.m
//  工程自身
//
//  Created by weidawei on 14-10-29.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "WeiPlist.h"

@implementation WeiPlist


- (NSDictionary *)dictionaryData:(NSString *)str
{
    NSString *path = [[NSBundle mainBundle] pathForResource:str ofType:@"plist"];
    NSString *str1 = [str stringByAppendingFormat:@".plist"];
    
    
    NSArray *patharray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *pat11 = [patharray objectAtIndex:0];
    
    NSString *filepath = [pat11 stringByAppendingPathComponent:str1];
    NSDictionary *dic1 = [NSDictionary dictionaryWithContentsOfFile:filepath];
    if (dic1 == nil) {
        
        NSDictionary *data = [NSDictionary dictionaryWithContentsOfFile:path];
        BOOL dicresult = [data writeToFile:filepath atomically:YES];
        dic1 = [NSDictionary dictionaryWithContentsOfFile:filepath];
//        NSLog(@"222222dic没有写入");
        NSLog(@"写入结果%d", dicresult);
    }
    return dic1;
    
}

@end
